export const getItemInArray = (key, value, arr)=> {
  let item = null
  if (!key || !value || !arr || arr.length < 1) {
    return false
  }
  for (let i = 0; i < arr.length; i++) {
    if (arr[i][key] === value) {
      item = arr[i]
      break
    }
  }
  return item
}

// 请求blob对象
export const GetBlob = (url) => {
  return new Promise((resolve) => {
    const xhr = new XMLHttpRequest()
    xhr.open('GET', url, true)
    xhr.responseType = 'blob'
    xhr.onload = () => {
      if (xhr.status === 200) {
        resolve(xhr.response)
      }
    }
    xhr.send()
  })
}
